using Client.Base;
using Libs.LEvent;
using System.Collections.Generic;
using System;
using UnityEngine;

namespace Client.Hotfix
{
    [SSM(SSMWeight.EventService)]
    public class EventService : IAwake,ITick,IDestroy
    {
        private readonly LEvents<int> lEvent = new LEvents<int>();
        public void Awake(params object[] args)
        {
            lEvent.Awake();
            this.Log("[ Service ] - EventService is running...");
        }

        public void Tick() =>lEvent.Tick();
        public void Destroy() => lEvent.Destroy();
        public void AddListener(int key, Action<object> handle) => lEvent.AddListener(key, handle);
        public void RemoveListenerByKey(int key) => lEvent.RemoveListenerByKey(key);
        public void RemoveListenerByClass(object target) =>lEvent.RemoveListenerByTarget(target);
        public void Call(int key, object arg = null) => lEvent.Call(key, arg);
        public void CallNow(int key, object arg = null) => lEvent.CallNow(key, arg);
        public List<Action<object>> GetEventsByKey(int key) => lEvent.GetEventsByKey(key);
    }
}

